package Test;

class Animal{
    protected String name;
    public Animal eat() {
        System.out.println(name + "正在吃饭");
        return null;
    }

    public Dog sleep(){
        System.out.println(name + "正在睡觉");
        return null;
    }
/*    public Animal test(){
        Animal a = new Animal();
        return a;
    }*/
/*    public Dog test(){
        Dog d = new Dog();
        return d;
    }*/
}

class Dog extends Animal{
    public Dog eat() {
        System.out.println(name + "正在吃狗粮");
        return null;
    }

/*
    public Animal sleep(){
        System.out.println(name + "正在睡觉");
        return null;
    }
*/

/*    public Dog test(){
        Dog d = new Dog();
        return d;
    }*/
}

class C extends Animal{
    public void test(){
        System.out.println("C::test()......");
    }
}

public class Test {
/*    public static void main(String[] args) {
        A a = new B();
        if(a instanceof C){
            ((C) a).test();
        }else{
            ((B) a).test();
        }
    }*/
}